package com.xhsj.user.pms.overseas.service;

import com.xhsj.user.hr.base.BaseService;
import com.xhsj.user.pms.overseas.entity.TbPamOverseasApplyFileType;
import com.xhsj.user.pms.overseas.mapper.TbPamOverseasApplyFileTypeMapper;
import com.xhsj.user.pms.overseas.service.TbPamOverseasApplyFileTypeService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
/**
 * <p>
 * 专利模块海外申请文件类型 服务实现类
 * </p>
 *
 * @author liuqinghua
 * @since Jun 2, 2021 9:39:21 AM
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class TbPamOverseasApplyFileTypeService extends BaseService<TbPamOverseasApplyFileTypeMapper, TbPamOverseasApplyFileType> {
    @Autowired
    private TbPamOverseasApplyFileTypeMapper dao;

	/**
	 * 保存
	 * @author liuqinghua
	 * @date Jun 2, 2021 9:39:21 AM
	 */
    @Override
    public boolean save(TbPamOverseasApplyFileType entity) {
        return super.save(entity);
    }

	/**
	 * 通过id获取数据
	 * @author liuqinghua
	 * @date Jun 2, 2021 9:39:21 AM
	 */
    @Override
    public TbPamOverseasApplyFileType getById(Serializable id) {
        return super.getById(id);
    }

	/**
	 * 通过id删除数据
	 * @author liuqinghua
	 * @date Jun 2, 2021 9:39:21 AM
	 */
    @Override
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

	/**
	 * 分页查询数据
	 * @author liuqinghua
	 * @date Jun 2, 2021 9:39:21 AM
	 */
    public IPage<TbPamOverseasApplyFileType> selectPage(Map<String,Object> data) {
        int currentPage=1;
        if (!Objects.isNull(data.get("page"))) {
            currentPage=(Integer) data.get("page");
        }
        int pageSize=20;
        if (!Objects.isNull(data.get("size"))) {
            pageSize=(Integer) data.get("size");
        }

        TbPamOverseasApplyFileType entity = JSON.parseObject(JSON.toJSONString(data), TbPamOverseasApplyFileType.class);
        Page<TbPamOverseasApplyFileType> page = new Page(currentPage,pageSize);
        QueryWrapper<TbPamOverseasApplyFileType> wrapper = new QueryWrapper(entity);
        return super.selectPage(page, wrapper);
    }

	/**
	 * 查询所有数据
	 * @author liuqinghua
	 * @date Jun 2, 2021 9:39:21 AM
	 */
    @Override
    public List<TbPamOverseasApplyFileType> selectAll() {
        return super.selectAll();
    }


}
